package demo5;

public class operator {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        int c = 30;
        int d = 25;
        System.out.println("a+b=" + (a + b));
        System.out.println("a-b=" + (a - b));
        System.out.println("a*b=" + (a * b));
        System.out.println("a/b=" + (b / a));
        System.out.println("a%b=" + (a % b));

        System.out.println("a++=" + (a++));
        System.out.println("a--=" + (a--));
        System.out.println("d++=" + (d++));
        System.out.println("++d=" + (++d));

        a = 10;
        b = 20;
        System.out.println("a == b = " + (a == b));
        System.out.println("a != b = " + (a != b));
        System.out.println("a > b = " + (a > b));
        System.out.println("a < b = " + (a < b));
        System.out.println("a >= b = " + (a >= b));
        System.out.println("a <= b = " + (a <= b));

//        三元运算符
        int y, x;
        x = 10;
        y = (x == 10) ? 20 : 30;
        System.out.println("y的值是：" + y);

        y = (x == 1) ? 20 : 30;
        System.out.println("y的值是：" + y);
    }
}
